﻿<ul class="right">
    @if (User.Identity.IsAuthenticated)
    {
        using (Html.BeginForm("Logout", "Account"))
        {
            @Html.AntiForgeryToken()
            <li><a href="@Url.Action("Index", "Account")">@User.Identity.Name</a></li>
            if (User.Identity.IsAuthenticated && User.IsInRole("admin"))
            {
                <li><a href="@Url.Action("Index","Admin")">后台管理</a></li>
            }
            <li>
                <input type="submit" value="注销" />
            </li>
        }
    }
    else
    {
        <li>@Html.ActionLink("注册", "Register", "Account")</li>
        <li>@Html.ActionLink("登录", "Login", "Account")</li>
    }
</ul>